package com.lianjinsu.shop.repository.dao.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lianjinsu.shop.core.mybatis.AdvancedDaoImpl;
import com.lianjinsu.shop.entity.User;
import com.lianjinsu.shop.repository.dao.UserDao;
import com.lianjinsu.shop.repository.mapper.UserMapper;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl extends AdvancedDaoImpl<UserMapper, User> implements UserDao {

    @Override
    public boolean updateUser(String field, Object value, String openId) {
        User user = new User();
        user.setOpenid(openId);
        UpdateWrapper<User> wrapper = Wrappers.update();
        wrapper.eq(field, value);
        return update(user, wrapper);
    }
}
